//
// Created by liushuai on 2021/2/19.
//

#include "arrangeCoins.h"
<<<<<<< HEAD:cxx/algorithm/src/arrangeCoins.cc
int arrangeCoins(int n){
    if (n <=1)
        return n;
    int i = 1;
    long long sum = 1;
    int count = 1;
    for(int i=2;i<n;i++){
        sum += i;
        if(sum>n)
            break;
        count++;
    }
    return count;
=======
int arrangeCoins(int n) {
  if (n <= 1) return n;
  int i = 1;
  long long sum = 1;
  int count = 1;
  for (int i = 2; i < n; i++) {
    sum += i;
    if (sum > n) break;
    count++;
  }
  return count;
>>>>>>> dev:cxx/algorithm/common/src/arrangeCoins.cc
}